<template>
  <div class="cash-result">
    <div class="step-box van-hairline--bottom">
      <div class="item" :class="{'active': !walletType}">
        <div class="cnt">
          <div class="icon">
            <i class="iconfont icon-chat_register_rb_s" v-if="!walletType"></i>
            <div class="circle" v-else></div>
          </div>
          <div class="text">
            <p>发起提现申请</p>
          </div>
        </div>
      </div>
      <div class="item" :class="{'active': walletType}">
        <div class="cnt">
          <div class="icon">
            <div class="circle" v-if="!walletType"></div>
            <i class="iconfont icon-chat_register_rb_s" v-else></i>
          </div>
          <div class="text">
            <p>到账成功</p>
            <div class="tips" v-show="!walletType">预计1-7个工作日到账</div>
          </div>
        </div>
      </div>
      <div class="line"></div>
      <div class="line2" :class="{'active-line': walletType}"></div>
    </div>
    <div class="money-tips">
      <div class="total-money">
        <span>提现金额</span>
        <p>￥{{withdrawPrice}}</p>
      </div>
      <div class="account">
        <span>到账账户</span>
        <p>微信钱包</p>
      </div>
    </div>
    <div class="action-btn" @click="goMoney">完成</div>
  </div>
</template>

<script>
export default {
  data() {
    return {
      withdrawPrice: '',
      walletType: false
    }
  },
  created() {
    this.withdrawPrice = this.$route.query.withdrawPrice
    this.walletType = this.$route.query.walletType == 'true'
  },
  methods: {
    goMoney() {
      this.$router.push('/money/wallet')
    },
    goBack() {
      this.$router.replace({ path: '/money/wallet' })
    }
  },
  mounted() {
    debugger
    if (window.history && window.history.pushState) {
      history.pushState(null, null, document.URL)
      window.addEventListener('popstate', this.goBack, false)
    }
  },
  destroyed() {
    window.removeEventListener('popstate', this.goBack, false)
  }
}
</script>

<style lang="less" scoped>
.cash-result {
  font-size: 14px;
  color: #9ca5b5;
  padding: 32px 16px;
  .step-box {
    padding: 0 16px 30px;
    .item {
      font-size: 16px;
      position: relative;
      .cnt {
        display: flex;
        align-items: center;
        .icon {
          width: 20px;
          z-index: 2;
          i {
            font-size: 22px;
            background-color: #fff;
          }
          .circle {
            width: 10px;
            height: 10px;
            border-radius: 50%;
            background-color: #9ca5b5;
            margin-left: 5px;
            position: relative;
            z-index: 2;
          }
          margin-right: 20px;
        }
        .text {
          p {
            font-size: 16px;
            color: #000;
          }
          .tips {
            font-size: 14px;
            padding-top: 8px;
            color: #9ca5b5;
          }
        }
      }
      &:first-child {
        height: 80px;
      }
      &.active {
        color: #007ae6;
        .cnt {
          .text {
            p {
              color: #007ae6;
            }
          }
        }
      }
    }
    .line,
    .line2 {
      background-color: #007ae6;
      width: 1px;
      position: absolute;
      top: 10px;
      left: 26px;
      height: 46px;
      z-index: 1;
    }
    .line2 {
      top: 54px;
      background-color: #9ca5b5;
      &.active-line {
        background-color: #007ae6;
      }
    }
  }
  .money-tips {
    margin-top: 16px;
    .total-money,
    .account {
      display: flex;
      align-items: center;
      font-size: 14px;
      margin-bottom: 10px;
      span {
        color: #9ca5b5;
      }
      p {
        color: #13284d;
        flex: 1;
        text-align: right;
      }
    }
  }
  .action-btn {
    width: 134px;
    height: 44px;
    background: rgba(0, 122, 230, 1);
    border-radius: 6px;
    margin: 122px auto 0;
    font-size: 16px;
    color: #fff;
    line-height: 44px;
    text-align: center;
  }
}
</style>